<!DOCTYPE html>
<html lang="en-US">
    <head>
        <title>Module::Pluggable - automatically give your module the ability to have plugins - metacpan.org</title>
        <link rel="preload" as="fetch" href="https://metacpan.org/account/login_status" crossorigin="anonymous" />
        <link href="https://metacpan.org/_assets/b8ccceeed47a0652049703d99326a9cea4933443.css" rel="stylesheet" type="text/css">
        <script src="https://metacpan.org/_assets/6bfedafe2d7caa915b7d84f61b45936818e3242e.js" type="text/javascript" defer></script>
        <link rel="alternate" type="application/rss+xml" title="Recent CPAN Uploads of Module-Pluggable - MetaCPAN" href="https://metacpan.org/dist/Module-Pluggable/releases.rss" />
        <link rel="canonical" href="./Module::Pluggable.html" />
        <meta name="description" content="automatically give your module the ability to have plugins" />
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5">
        <link rel="shortcut icon" href="https://metacpan.org/static/icons/favicon.ico">
        <link rel="apple-touch-icon" sizes="152x152" href="https://metacpan.org/static/icons/apple-touch-icon.png">
        <link rel="search" href="https://metacpan.org/static/opensearch.xml" type="application/opensearchdescription+xml" title="MetaCPAN">
        <script>
          (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
          (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
          })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

          (function(skey, ga_id){
            ga('create', ga_id, {
              siteSpeedSampleRate : 100,
              storage             : 'none',
              clientId            : localStorage.getItem(skey)
            });
            ga(function(tracker) {
              localStorage.setItem(skey, tracker.get('clientId'));
            });
            ga('send', 'pageview');
          })('ga:clientId', 'UA-27829474-1');
        </script>
<meta name="twitter:card"        content="summary" />
<meta name="twitter:url"         content="https://metacpan.org/pod/Module::Pluggable" />
<meta name="twitter:title"       content="Module::Pluggable" />
<meta name="twitter:description" content="automatically give your module the ability to have plugins" />
<meta name="twitter:site"        content="metacpan" />
    </head>
    <body>
        <nav class="navbar navbar-default" role="navigation">
            <div class="header-logo-large hidden-xs">
              <a href="https://metacpan.org/" tabindex="0">
                <svg class="logo" aria-label="MetaCPAN">
                  <use class="logo" href="/static/images/metacpan-logo.svg#logo" />
                </svg>
              </a>
            </div>
            <div class="header-logo-icon visible-xs">
              <a href="https://metacpan.org/">
                <svg class="logo" aria-label="MetaCPAN">
                  <use class="logo" href="/static/images/metacpan-logo.svg#dots" />
                </svg>
              </a>
            </div>
            <ul class="nav navbar-nav menu-items hidden-xs hidden-sm">
              <li><a href="https://metacpan.org/about">About</a></li>
              <li><a href="https://metacpan.org/about/sponsors">Sponsor</a></li>
              <li><a href="https://grep.metacpan.org/">grep::cpan</a></li>
              <li><a href="https://metacpan.org/recent">Recent</a></li>
              <li><a href="https://metacpan.org/about/faq">FAQ</a></li>
              <li><a href="https://metacpan.org/tools">Tools</a></li>
              <li><a href="https://fastapi.metacpan.org/">API</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <button type="button" class="searchbar-btn visible-xs visible-sm">
                    <i class="fa fa-search button-fa-icon"></i>
                </button>
                <form action="https://metacpan.org/search" class="searchbar-form visible-md visible-lg search-form form-horizontal">
                   <input type="hidden" name="size" id="metacpan_search-size" value="20">
                  <div class="form-group">
                      <div class="search-group">
                        <i class="fa fa-search"></i>
                        <input type="text" name="q" placeholder="Search the CPAN" size="41" autocorrect="off" autocapitalize="off" spellcheck="false" id="metacpan_search-input" class="form-control" value="">
                      </div>
                  </div>
                </form>
                    <li class="icon-slidepanel visible-xs visible-sm">
                      <button data-toggle="slidepanel" data-target=".slidepanel">
                        <span class="button-fa-icon">
                          <i class="fa fa-bars slidepanel-open"></i>
                          <i class="fa fa-times slidepanel-close"></i>
                        </span>
                      </button>
                    </li>
                <form action="https://metacpan.org/account/logout" method="POST" id="metacpan-logout"></form>
                <li class="dropdown logged_in" style="display: none;">
                    <button type="button" class="dropdown-toggle" data-toggle="dropdown">
                      <i class="fa fa-user button-fa-icon logged-in-icon" aria-hidden="true"></i>
                      <i class="fas fa-chevron-down"></i>
                    </button>
                    <ul class="dropdown-menu">
                        <li><a href="https://metacpan.org/account/identities">Identities</a></li>
                        <li><a href="https://metacpan.org/account/profile">Profile</a></li>
                        <li><a href="https://metacpan.org/account/favorite/list">Favorites</a></li>
                        <li>
                            <a href="./Module::Pluggable.html#" type="button" onclick="$('#metacpan-logout').submit(); return false">
                              Logout
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown logged_out" style="display: none;">
                    <button type="button" class="dropdown-toggle" data-toggle="dropdown">
                      <i class="fa fa-user button-fa-icon" aria-hidden="true"></i>
                      <i class="fas fa-chevron-down"></i>
                    </button>
                    <ul class="dropdown-menu">
                        <li>
                            <a href="https://metacpan.org/login/github">
                                <i class="fab fa-github fa-fw"></i>
                                GitHub
                            </a>
                        </li>
                        <li>
                            <a href="https://metacpan.org/login/twitter">
                                <i class="fab fa-twitter fa-fw"></i>
                                Twitter
                            </a>
                        </li>
                        <li>
                            <a href="https://metacpan.org/login/google">
                                <i class="fab fa-google fa-fw"></i>
                                Google
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown logged_placeholder">
                    <button>
                      <i class="fa fa-user button-fa-icon" aria-hidden="true"></i>
                    </button>
                </li>
            </ul>
        </nav>
        <div class="page-content ">
          <!--
          <div class="top-notify-banner">
            <i class="fas fa-info-circle"></i>
          </div>
          -->
          <nav class="sidebar">
            <div class="slidepanel">
              <ul class="nav-list ">
    <li class="nav-header no-margin-top">
      <div class="ttip" data-toggle="tooltip" data-placement="bottom" title="The date that this version of Module-Pluggable was released.">
      <span class="relatize">05 Aug 2015 23:34:16 UTC</span>
    </li>
  <li>
    Distribution: <a href="https://metacpan.org/dist/Module-Pluggable">Module-Pluggable</a>
  </li>
  <li>
    Module version: 5.2
  </li>
  <li>
    <a data-keyboard-shortcut="g s" href="https://metacpan.org/dist/Module-Pluggable/source/lib/Module/Pluggable.pm">Source</a>
    (<a href="https://metacpan.org/dist/Module-Pluggable/source/lib/Module/Pluggable.pm?raw=1">raw</a>)
  </li>
  <li>
    <a data-keyboard-shortcut="g b" href="https://metacpan.org/dist/Module-Pluggable/source/lib/Module">Browse</a>
    (<a href="https://metacpan.org/dist/Module-Pluggable/source/lib/Module?raw=1">raw</a>)
  </li>
    <li>
      <a data-keyboard-shortcut="g c" href="https://metacpan.org/dist/Module-Pluggable/changes">Changes</a>
    </li>
    <li>
      <a class="nopopup" href="https://metacpan.org/dist/Module-Pluggable/contribute">How to Contribute</a>
    </li>
    <li>
        <a rel="noopener nofollow" data-keyboard-shortcut="g r" href="https://github.com/simonwistow/Module-Pluggable">Repository</a>
    </li>
    <li>
      <a rel="noopener nofollow" data-keyboard-shortcut="g i" href="https://rt.cpan.org/Public/Dist/Display.html?Name=Module-Pluggable">Issues</a>
      (12)
    </li>
    <li>
      <a rel="noopener nofollow" href="http://matrix.cpantesters.org/?dist=Module-Pluggable+5.2" title="Matrix">Testers</a>
        <span title="(pass / fail / na)">(<a rel="noopener nofollow" href="https://www.cpantesters.org/distro/M/Module-Pluggable.html?oncpan=1&amp;distmat=1&amp;version=5.2&amp;grade=2" style="color: #090">7361</a> / <a rel="noopener nofollow" href="https://www.cpantesters.org/distro/M/Module-Pluggable.html?oncpan=1&amp;distmat=1&amp;version=5.2&amp;grade=3" style="color: #900">149</a> / <a rel="noopener nofollow" href="https://www.cpantesters.org/distro/M/Module-Pluggable.html?oncpan=1&amp;distmat=1&amp;version=5.2&amp;grade=4">3</a>)</span>
    </li>
    <li>
      <a rel="noopener nofollow" href="http://cpants.cpanauthors.org/release/SIMONW/Module-Pluggable-5.2">Kwalitee</a>
    </li>
    <li>
      <div class="ttip" data-toggle="tooltip" data-placement="bottom" title="The # people with an indexing permission on Module-Pluggable who have released something to CPAN in the last 2 years (i.e. the # people likely able to release critical fixes in a timely manner)">
      Bus factor: 0
      </div>
    </li>
    <li>
      <a rel="noopener nofollow" href="http://cpancover.com/latest/Module-Pluggable-5.2/index.html">85.55% Coverage </a>
    </li>
    <li>
      License: perl_5
    </li>
    <li>
      Perl: v5.5.30
    </li>
    <li class="nav-header">Activity</li>
    <li>
<div class="activity-graph">
    <img src="https://metacpan.org/dist/Module-Pluggable/activity.svg?res=month" />
    <div class="comment">24 month</div>
</div>
    </li>
    <li class="nav-header">Tools</li>
    <li>
      <a itemprop="downloadUrl" href="https://cpan.metacpan.org/authors/id/S/SI/SIMONW/Module-Pluggable-5.2.tar.gz">
      Download (<span itemprop="fileSize">26.29KB</span>)</a>
    </li>
    <li>
      <a href="https://explorer.metacpan.org/?url=%2Fmodule%2FSIMONW%2FModule-Pluggable-5.2%2Flib%2FModule%2FPluggable.pm">
        MetaCPAN Explorer
      </a>
    </li>
    <li>
      <a href="https://metacpan.org/dist/Module-Pluggable/permissions">
        Permissions
      </a>
    </li>
    <li>
      <a href="https://metacpan.org/dist/Module-Pluggable/releases.rss">
        Subscribe to distribution
      </a>
    </li>
    <li>
      <button class="btn btn-link" data-toggle="modal" data-target="#metacpan_install-instructions-dialog">
        Install Instructions
      </button>
    </li>
    <li>
      <form action="https://metacpan.org/search">
        <input type="hidden" name="q" value="dist:Module-Pluggable">
        <input type="search" name="q" placeholder="Search distribution" class="form-control tool-bar-form">
        <input type="submit" style="display: none">
      </form>
    </li>
    <li>
      <form action="https://grep.metacpan.org/search">
        <input type="hidden" name="qd" value="Module-Pluggable">
        <input type="hidden" name="source" value="metacpan">
        <input type="search" name="q" placeholder="grep distribution" class="form-control tool-bar-form">
        <input type="submit" style="display: none">
     </form>
    </li>
    <li class="version-jump">
<select onchange="document.location.href=&#39;/release/&#39;+this.value+&#39;/view/lib/Module/Pluggable.pm&#39;" class="form-control tool-bar-form">
  <option disabled selected>Jump to version</option>
<option
  disabled
  value="SIMONW/Module-Pluggable-5.2"
>5.2
  (SIMONW on 2015-08-05)</option>
<option
  
  value="SIMONW/Module-Pluggable-5.1"
>5.1
  (SIMONW on 2014-01-06)</option>
<option
  
  value="SIMONW/Module-Pluggable-5.0"
>5.0
  (SIMONW on 2014-01-03)</option>
<option
  
  value="SIMONW/Module-Pluggable-4.8"
>4.8
  (SIMONW on 2013-05-27)</option>
<option
  
  value="SIMONW/Module-Pluggable-4.7"
>4.7
  (SIMONW on 2013-02-26)</option>
<option
  
  value="SIMONW/Module-Pluggable-4.6"
>4.6
  (SIMONW on 2013-01-24)</option>
<option
  
  value="SIMONW/Module-Pluggable-4.5"
>4.5
  (SIMONW on 2012-11-06)</option>
<option
  
  value="SIMONW/Module-Pluggable-4.4"
>4.4
  (SIMONW on 2012-11-06)</option>
<option
  
  value="SIMONW/Module-Pluggable-4.3"
>4.3
  (SIMONW on 2012-08-15)</option>
<option
  
  value="SIMONW/Module-Pluggable-4.2"
>4.2
  (SIMONW on 2012-08-14)</option>
<option
  
  value="SIMONW/Module-Pluggable-4.1"
>4.1
  (SIMONW on 2012-08-13)</option>
<option
  
  value="SIMONW/Module-Pluggable-4.0"
>4.0
  (SIMONW on 2012-01-03)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.9"
>3.9
  (SIMONW on 2009-03-16)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.8"
>3.8
  (SIMONW on 2008-03-16)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.7"
>3.7
  (SIMONW on 2008-03-12)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.6"
>3.6
  (SIMONW on 2007-04-07)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.5"
>3.5
  (SIMONW on 2007-01-29)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.4"
>3.4
  (SIMONW on 2006-11-27)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.3"
>3.3
  (SIMONW on 2006-11-24)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.2"
>3.2
  (SIMONW on 2006-11-15)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.1"
>3.1
  (SIMONW on 2006-07-11)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.01"
>3.01
  (SIMONW on 2006-06-07)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.0"
>3.0
  (SIMONW on 2006-06-05)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.97"
>2.97
  (SIMONW on 2006-02-06)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.96"
>2.96
  (SIMONW on 2005-09-01)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.95"
>2.95
  (SIMONW on 2005-07-30)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.9"
>2.9
  (SIMONW on 2005-07-09)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.8"
>2.8
  (SIMONW on 2005-03-18)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.7"
>2.7
  (SIMONW on 2005-02-21)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.6"
>2.6
  (SIMONW on 2005-02-02)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.5"
>2.5
  (SIMONW on 2005-01-18)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.4"
>2.4
  (SIMONW on 2004-12-15)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.3"
>2.3
  (SIMONW on 2004-10-27)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.2"
>2.2
  (SIMONW on 2004-10-07)</option>
<optgroup label="BackPAN">'
<option
  
  value="SIMONW/Module-Pluggable-2.0"
>2.0
  (SIMONW on 2004-08-19)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.9"
>1.9
  (SIMONW on 2004-07-18)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.8"
>1.8
  (SIMONW on 2004-07-08)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.7"
>1.7
  (SIMONW on 2004-07-07)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.6"
>1.6
  (SIMONW on 2004-06-03)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.5"
>1.5
  (SIMONW on 2004-05-25)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.4"
>1.4
  (SIMONW on 2004-05-25)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.2"
>1.2
  (SIMONW on 2004-05-06)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.11"
>1.11
  (SIMONW on 2004-01-30)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.1"
>1.1
  (SIMONW on 2004-01-29)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.00"
>1.00
  (SIMONW on 2003-12-15)</option>
<option
  
  value="SIMONW/Module-Pluggable-0.9"
>0.9
  (SIMONW on 2003-10-21)</option>
<option
  
  value="SIMONW/Module-Pluggable-0.8"
>0.8
  (SIMONW on 2003-10-20)</option>
<option
  
  value="SIMONW/Module-Pluggable-0.7"
>0.7
  (SIMONW on 2003-10-17)</option>
<option
  
  value="SIMONW/Module-Pluggable-0.6"
>0.6
  (SIMONW on 2003-10-15)</option>
</optgroup>
</select>
    </li>
    <li class="version-diff">
<select onchange="document.location.href='/release/SIMONW/Module-Pluggable-5.2/diff/' + encodeURIComponent(this.value) + '/lib/Module/Pluggable.pm'
" class="form-control tool-bar-form">
  <option disabled selected>Diff with version</option>
<option
  disabled
  value="SIMONW/Module-Pluggable-5.2"
>5.2
  (SIMONW on 2015-08-05)</option>
<option
  
  value="SIMONW/Module-Pluggable-5.1"
>5.1
  (SIMONW on 2014-01-06)</option>
<option
  
  value="SIMONW/Module-Pluggable-5.0"
>5.0
  (SIMONW on 2014-01-03)</option>
<option
  
  value="SIMONW/Module-Pluggable-4.8"
>4.8
  (SIMONW on 2013-05-27)</option>
<option
  
  value="SIMONW/Module-Pluggable-4.7"
>4.7
  (SIMONW on 2013-02-26)</option>
<option
  
  value="SIMONW/Module-Pluggable-4.6"
>4.6
  (SIMONW on 2013-01-24)</option>
<option
  
  value="SIMONW/Module-Pluggable-4.5"
>4.5
  (SIMONW on 2012-11-06)</option>
<option
  
  value="SIMONW/Module-Pluggable-4.4"
>4.4
  (SIMONW on 2012-11-06)</option>
<option
  
  value="SIMONW/Module-Pluggable-4.3"
>4.3
  (SIMONW on 2012-08-15)</option>
<option
  
  value="SIMONW/Module-Pluggable-4.2"
>4.2
  (SIMONW on 2012-08-14)</option>
<option
  
  value="SIMONW/Module-Pluggable-4.1"
>4.1
  (SIMONW on 2012-08-13)</option>
<option
  
  value="SIMONW/Module-Pluggable-4.0"
>4.0
  (SIMONW on 2012-01-03)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.9"
>3.9
  (SIMONW on 2009-03-16)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.8"
>3.8
  (SIMONW on 2008-03-16)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.7"
>3.7
  (SIMONW on 2008-03-12)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.6"
>3.6
  (SIMONW on 2007-04-07)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.5"
>3.5
  (SIMONW on 2007-01-29)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.4"
>3.4
  (SIMONW on 2006-11-27)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.3"
>3.3
  (SIMONW on 2006-11-24)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.2"
>3.2
  (SIMONW on 2006-11-15)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.1"
>3.1
  (SIMONW on 2006-07-11)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.01"
>3.01
  (SIMONW on 2006-06-07)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.0"
>3.0
  (SIMONW on 2006-06-05)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.97"
>2.97
  (SIMONW on 2006-02-06)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.96"
>2.96
  (SIMONW on 2005-09-01)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.95"
>2.95
  (SIMONW on 2005-07-30)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.9"
>2.9
  (SIMONW on 2005-07-09)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.8"
>2.8
  (SIMONW on 2005-03-18)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.7"
>2.7
  (SIMONW on 2005-02-21)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.6"
>2.6
  (SIMONW on 2005-02-02)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.5"
>2.5
  (SIMONW on 2005-01-18)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.4"
>2.4
  (SIMONW on 2004-12-15)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.3"
>2.3
  (SIMONW on 2004-10-27)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.2"
>2.2
  (SIMONW on 2004-10-07)</option>
<optgroup label="BackPAN">'
<option
  
  value="SIMONW/Module-Pluggable-2.0"
>2.0
  (SIMONW on 2004-08-19)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.9"
>1.9
  (SIMONW on 2004-07-18)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.8"
>1.8
  (SIMONW on 2004-07-08)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.7"
>1.7
  (SIMONW on 2004-07-07)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.6"
>1.6
  (SIMONW on 2004-06-03)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.5"
>1.5
  (SIMONW on 2004-05-25)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.4"
>1.4
  (SIMONW on 2004-05-25)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.2"
>1.2
  (SIMONW on 2004-05-06)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.11"
>1.11
  (SIMONW on 2004-01-30)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.1"
>1.1
  (SIMONW on 2004-01-29)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.00"
>1.00
  (SIMONW on 2003-12-15)</option>
<option
  
  value="SIMONW/Module-Pluggable-0.9"
>0.9
  (SIMONW on 2003-10-21)</option>
<option
  
  value="SIMONW/Module-Pluggable-0.8"
>0.8
  (SIMONW on 2003-10-20)</option>
<option
  
  value="SIMONW/Module-Pluggable-0.7"
>0.7
  (SIMONW on 2003-10-17)</option>
<option
  
  value="SIMONW/Module-Pluggable-0.6"
>0.6
  (SIMONW on 2003-10-15)</option>
</optgroup>
</select>
    </li>

    <li>
<ul class="dependencies">
  <li class="nav-header">Dependencies</li>
  <li><a href="https://metacpan.org/pod/Exporter" title="Exporter" class="ellipsis">Exporter</a></li>
  <li><a href="https://metacpan.org/pod/File::Basename" title="File::Basename" class="ellipsis">File::Basename</a></li>
  <li><a href="https://metacpan.org/pod/File::Find" title="File::Find" class="ellipsis">File::Find</a></li>
  <li><a href="https://metacpan.org/pod/File::Spec" title="File::Spec" class="ellipsis">File::Spec</a></li>
  <li><a href="https://metacpan.org/pod/File::Spec::Functions" title="File::Spec::Functions" class="ellipsis">File::Spec::Functions</a></li>
  <li><a href="https://metacpan.org/pod/if" title="if" class="ellipsis">if</a></li>
  <li><a href="https://metacpan.org/pod/strict" title="strict" class="ellipsis">strict</a></li>
  <li>
    <hr>
  </li>
  <li>
    <a href="https://metacpan.org/module/Module::Pluggable/requires">Reverse dependencies</a>
  </li>
  <li>
    <a href="http://deps.cpantesters.org/?module=Module%3A%3APluggable">CPAN Testers List</a>
  </li>
  <li>
    <a href="https://cpandeps.grinnz.com/?dist=Module-Pluggable">Dependency graph</a>
  </li>
</ul>
    </li>
    <li class="nav-header">Permalinks</li>
    <li>
      <a href="https://metacpan.org/release/SIMONW/Module-Pluggable-5.2/view/lib/Module/Pluggable.pm">This version</a>
    </li>
    <li>
      <a href="./Module::Pluggable.html">Latest version</a>
    </li>
    <li>
<div class="plussers">
<div class="nav-header">++ed by:</div>
<div>
<a class="display-all" href="https://metacpan.org/author/KRAUTCAT"><img src="https://www.gravatar.com/avatar/efd137d1577aa9df7fc833f6306958d5?d=identicon&amp;s=20" title="KRAUTCAT" alt="KRAUTCAT"></a>
<a class="display-all" href="https://metacpan.org/author/ARJONES"><img src="https://www.gravatar.com/avatar/779fdd029141571e2650d9060978c1a1?d=identicon&amp;s=20" title="ARJONES" alt="ARJONES"></a>
<a class="display-all" href="https://metacpan.org/author/HMA"><img src="https://www.gravatar.com/avatar/eb0885a144e4c9ec1f0c360e9da7f72f?d=identicon&amp;s=20" title="HMA" alt="HMA"></a>
<a class="display-all" href="https://metacpan.org/author/ROBINS"><img src="https://www.gravatar.com/avatar/912ff9b193ab184e3d04c4b9e10bde71?d=identicon&amp;s=20" title="ROBINS" alt="ROBINS"></a>
<a class="display-all" href="https://metacpan.org/author/PINGAN"><img src="https://www.gravatar.com/avatar/a02222e5e0e4fd24d52fc29a08ac6bcb?d=identicon&amp;s=20" title="PINGAN" alt="PINGAN"></a>
</div>
<!-- Display counts of plussers-->
<div>
    <a href="https://metacpan.org/dist/Module-Pluggable/plussers">15 PAUSE users</a>
</div>
<div>
    9 non-PAUSE users
</div>
</div>
    </li>
    <li>
<div id="metacpan_contributors">
  <div>
    <button class="btn-link"
      onclick="$(this).hide(); $('#metacpan_contributors ul').slideDown(); return false;"
    >and 1 contributors</button>
  </div>
  <ul style="display: none">
    <li class="contributor"
      data-contrib-email="simon@thegestalt.org"
    >
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=identicon&amp;s=20" />
      Simon Wistow
    </li>
  </ul>
</div>
    </li>
              </ul>
            </div>
          </nav>
          <div class="content-navigation">
<div class="breadcrumbs">
  <span>
    <a data-keyboard-shortcut="g a" rel="author" href="https://metacpan.org/author/SIMONW" class="author-name">Simon Wistow</a>
  </span>
  <span>&nbsp;/&nbsp;</span>
  <div class="release dist-release status-latest maturity-released">
    <span class="dropdown"><b class="caret"></b></span>
<select onchange="document.location.href=&#39;/release/&#39;+this.value+&#39;/view/lib/Module/Pluggable.pm&#39;" class="">
<option
  selected
  value="SIMONW/Module-Pluggable-5.2"
>5.2
  (SIMONW on 2015-08-05)</option>
<option
  
  value="SIMONW/Module-Pluggable-5.1"
>5.1
  (SIMONW on 2014-01-06)</option>
<option
  
  value="SIMONW/Module-Pluggable-5.0"
>5.0
  (SIMONW on 2014-01-03)</option>
<option
  
  value="SIMONW/Module-Pluggable-4.8"
>4.8
  (SIMONW on 2013-05-27)</option>
<option
  
  value="SIMONW/Module-Pluggable-4.7"
>4.7
  (SIMONW on 2013-02-26)</option>
<option
  
  value="SIMONW/Module-Pluggable-4.6"
>4.6
  (SIMONW on 2013-01-24)</option>
<option
  
  value="SIMONW/Module-Pluggable-4.5"
>4.5
  (SIMONW on 2012-11-06)</option>
<option
  
  value="SIMONW/Module-Pluggable-4.4"
>4.4
  (SIMONW on 2012-11-06)</option>
<option
  
  value="SIMONW/Module-Pluggable-4.3"
>4.3
  (SIMONW on 2012-08-15)</option>
<option
  
  value="SIMONW/Module-Pluggable-4.2"
>4.2
  (SIMONW on 2012-08-14)</option>
<option
  
  value="SIMONW/Module-Pluggable-4.1"
>4.1
  (SIMONW on 2012-08-13)</option>
<option
  
  value="SIMONW/Module-Pluggable-4.0"
>4.0
  (SIMONW on 2012-01-03)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.9"
>3.9
  (SIMONW on 2009-03-16)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.8"
>3.8
  (SIMONW on 2008-03-16)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.7"
>3.7
  (SIMONW on 2008-03-12)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.6"
>3.6
  (SIMONW on 2007-04-07)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.5"
>3.5
  (SIMONW on 2007-01-29)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.4"
>3.4
  (SIMONW on 2006-11-27)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.3"
>3.3
  (SIMONW on 2006-11-24)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.2"
>3.2
  (SIMONW on 2006-11-15)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.1"
>3.1
  (SIMONW on 2006-07-11)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.01"
>3.01
  (SIMONW on 2006-06-07)</option>
<option
  
  value="SIMONW/Module-Pluggable-3.0"
>3.0
  (SIMONW on 2006-06-05)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.97"
>2.97
  (SIMONW on 2006-02-06)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.96"
>2.96
  (SIMONW on 2005-09-01)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.95"
>2.95
  (SIMONW on 2005-07-30)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.9"
>2.9
  (SIMONW on 2005-07-09)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.8"
>2.8
  (SIMONW on 2005-03-18)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.7"
>2.7
  (SIMONW on 2005-02-21)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.6"
>2.6
  (SIMONW on 2005-02-02)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.5"
>2.5
  (SIMONW on 2005-01-18)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.4"
>2.4
  (SIMONW on 2004-12-15)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.3"
>2.3
  (SIMONW on 2004-10-27)</option>
<option
  
  value="SIMONW/Module-Pluggable-2.2"
>2.2
  (SIMONW on 2004-10-07)</option>
<optgroup label="BackPAN">'
<option
  
  value="SIMONW/Module-Pluggable-2.0"
>2.0
  (SIMONW on 2004-08-19)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.9"
>1.9
  (SIMONW on 2004-07-18)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.8"
>1.8
  (SIMONW on 2004-07-08)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.7"
>1.7
  (SIMONW on 2004-07-07)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.6"
>1.6
  (SIMONW on 2004-06-03)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.5"
>1.5
  (SIMONW on 2004-05-25)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.4"
>1.4
  (SIMONW on 2004-05-25)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.2"
>1.2
  (SIMONW on 2004-05-06)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.11"
>1.11
  (SIMONW on 2004-01-30)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.1"
>1.1
  (SIMONW on 2004-01-29)</option>
<option
  
  value="SIMONW/Module-Pluggable-1.00"
>1.00
  (SIMONW on 2003-12-15)</option>
<option
  
  value="SIMONW/Module-Pluggable-0.9"
>0.9
  (SIMONW on 2003-10-21)</option>
<option
  
  value="SIMONW/Module-Pluggable-0.8"
>0.8
  (SIMONW on 2003-10-20)</option>
<option
  
  value="SIMONW/Module-Pluggable-0.7"
>0.7
  (SIMONW on 2003-10-17)</option>
<option
  
  value="SIMONW/Module-Pluggable-0.6"
>0.6
  (SIMONW on 2003-10-15)</option>
</optgroup>
</select>
    <a data-keyboard-shortcut="g d" class="release-name" href="https://metacpan.org/dist/Module-Pluggable">Module-Pluggable-5.2</a>
  </div>
<span class="river-gauge-gauge">
  <svg width="24px"
       height="15px"
       version="1.1"
       xmlns="http://www.w3.org/2000/svg"
       xmlns:xlink="http://www.w3.org/1999/xlink">

    <g>
      <title>        River stage four &#10;
          • 257 direct dependents &#10;          • 2862 total dependents
      </title>

      <rect x="0"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="5"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="10"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="15"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="20"  y="0" width="4" height="15" fill="#e4e2e2" />
    </g>
  </svg>

</span>
<div id="Module-Pluggable-fav" class="logged_in">
<form action="https://metacpan.org/account/favorite/add" style="display: inline" onsubmit="return favDistribution(this)">
    <input type="hidden" name="remove" value="0">
    <input type="hidden" name="release" value="Module-Pluggable-5.2">
    <input type="hidden" name="author" value="SIMONW">
    <input type="hidden" name="distribution" value="Module-Pluggable">
    <button type="submit" class="favorite highlight"><span>24</span> ++</button>
</form>
</div>
<div class="logged_out">
<a href="./Module::Pluggable.html" onclick="alert('Please sign in to add favorites'); return false" class="favorite highlight">
<span>24</span> ++</a>
</div>
   / <span>Module::Pluggable</span>
</div>
          </div>
          <main class="content">


<nav class="toc">
  <div class="toc-header"><strong>Contents</strong></div>
<ul>
  <li><a href="./Module::Pluggable.html#NAME">NAME</a></li>
  <li><a href="./Module::Pluggable.html#SYNOPSIS">SYNOPSIS</a></li>
  <li><a href="./Module::Pluggable.html#EXAMPLE">EXAMPLE</a></li>
  <li><a href="./Module::Pluggable.html#DESCRIPTION">DESCRIPTION</a></li>
  <li><a href="./Module::Pluggable.html#ADVANCED-USAGE">ADVANCED USAGE</a></li>
  <li><a href="./Module::Pluggable.html#PLUGIN-SEARCHING">PLUGIN SEARCHING</a></li>
  <li><a href="./Module::Pluggable.html#INNER-PACKAGES">INNER PACKAGES</a></li>
  <li><a href="./Module::Pluggable.html#OPTIONS">OPTIONS</a>
    <ul>
      <li><a href="./Module::Pluggable.html#sub_name">sub_name</a></li>
      <li><a href="./Module::Pluggable.html#search_path">search_path</a></li>
      <li><a href="./Module::Pluggable.html#search_dirs">search_dirs</a></li>
      <li><a href="./Module::Pluggable.html#instantiate">instantiate</a></li>
      <li><a href="./Module::Pluggable.html#require">require</a></li>
      <li><a href="./Module::Pluggable.html#inner">inner</a></li>
      <li><a href="./Module::Pluggable.html#only">only</a></li>
      <li><a href="./Module::Pluggable.html#except">except</a></li>
      <li><a href="./Module::Pluggable.html#package">package</a></li>
      <li><a href="./Module::Pluggable.html#file_regex">file_regex</a></li>
      <li><a href="./Module::Pluggable.html#include_editor_junk">include_editor_junk</a></li>
      <li><a href="./Module::Pluggable.html#follow_symlinks">follow_symlinks</a></li>
      <li><a href="./Module::Pluggable.html#min_depth,-max_depth">min_depth, max_depth</a></li>
    </ul>
  </li>
  <li><a href="./Module::Pluggable.html#TRIGGERS">TRIGGERS</a>
    <ul>
      <li><a href="./Module::Pluggable.html#before_require-%3Cplugin%3E">before_require &lt;plugin&gt;</a></li>
      <li><a href="./Module::Pluggable.html#on_require_error-%3Cplugin%3E-%3Cerr%3E">on_require_error &lt;plugin&gt; &lt;err&gt;</a></li>
      <li><a href="./Module::Pluggable.html#on_instantiate_error-%3Cplugin%3E-%3Cerr%3E">on_instantiate_error &lt;plugin&gt; &lt;err&gt;</a></li>
      <li><a href="./Module::Pluggable.html#after_require-%3Cplugin%3E">after_require &lt;plugin&gt;</a></li>
    </ul>
  </li>
  <li><a href="./Module::Pluggable.html#METHODs">METHODs</a>
    <ul>
      <li><a href="./Module::Pluggable.html#search_path1">search_path</a></li>
    </ul>
  </li>
  <li><a href="./Module::Pluggable.html#BEHAVIOUR-UNDER-TEST-ENVIRONMENT">BEHAVIOUR UNDER TEST ENVIRONMENT</a></li>
  <li><a href="./Module::Pluggable.html#@INC-hooks-and-App::FatPacker">@INC hooks and App::FatPacker</a></li>
  <li><a href="./Module::Pluggable.html#Module::Require-recommended">Module::Require recommended</a></li>
  <li><a href="./Module::Pluggable.html#FUTURE-PLANS">FUTURE PLANS</a></li>
  <li><a href="./Module::Pluggable.html#DEVELOPMENT">DEVELOPMENT</a></li>
  <li><a href="./Module::Pluggable.html#AUTHOR">AUTHOR</a></li>
  <li><a href="./Module::Pluggable.html#COPYING">COPYING</a></li>
  <li><a href="./Module::Pluggable.html#BUGS">BUGS</a></li>
  <li><a href="./Module::Pluggable.html#SEE-ALSO">SEE ALSO</a></li>
</ul></nav>
<div class="pod anchors">
<h1 id="NAME">NAME</h1>

<p>Module::Pluggable - automatically give your module the ability to have plugins</p>

<h1 id="SYNOPSIS">SYNOPSIS</h1>

<p>Simple use Module::Pluggable -</p>

<pre><code>    package MyClass;
    use Module::Pluggable;</code></pre>

<p>and then later ...</p>

<pre><code>    use MyClass;
    my $mc = MyClass-&gt;new();
    # returns the names of all plugins installed under MyClass::Plugin::*
    my @plugins = $mc-&gt;plugins();</code></pre>

<h1 id="EXAMPLE">EXAMPLE</h1>

<p>Why would you want to do this? Say you have something that wants to pass an object to a number of different plugins in turn. For example you may want to extract meta-data from every email you get sent and do something with it. Plugins make sense here because then you can keep adding new meta data parsers and all the logic and docs for each one will be self contained and new handlers are easy to add without changing the core code. For that, you might do something like ...</p>

<pre><code>    package Email::Examiner;

    use strict;
    use Email::Simple;
    use Module::Pluggable require =&gt; 1;

    sub handle_email {
        my $self  = shift;
        my $email = shift;

        foreach my $plugin ($self-&gt;plugins) {
            $plugin-&gt;examine($email);
        }

        return 1;
    }</code></pre>

<p>.. and all the plugins will get a chance in turn to look at it.</p>

<p>This can be trivially extended so that plugins could save the email somewhere and then no other plugin should try and do that. Simply have it so that the <code>examine</code> method returns <code>1</code> if it has saved the email somewhere. You might also want to be paranoid and check to see if the plugin has an <code>examine</code> method.</p>

<pre><code>        foreach my $plugin ($self-&gt;plugins) {
            next unless $plugin-&gt;can(&#39;examine&#39;);
            last if     $plugin-&gt;examine($email);
        }</code></pre>

<p>And so on. The sky&#39;s the limit.</p>

<h1 id="DESCRIPTION">DESCRIPTION</h1>

<p>Provides a simple but, hopefully, extensible way of having &#39;plugins&#39; for your module. Obviously this isn&#39;t going to be the be all and end all of solutions but it works for me.</p>

<p>Essentially all it does is export a method into your namespace that looks through a search path for .pm files and turn those into class names.</p>

<p>Optionally it instantiates those classes for you.</p>

<h1 id="ADVANCED-USAGE"><a id="ADVANCED"></a>ADVANCED USAGE</h1>

<p>Alternatively, if you don&#39;t want to use &#39;plugins&#39; as the method ...</p>

<pre><code>    package MyClass;
    use Module::Pluggable sub_name =&gt; &#39;foo&#39;;</code></pre>

<p>and then later ...</p>

<pre><code>    my @plugins = $mc-&gt;foo();</code></pre>

<p>Or if you want to look in another namespace</p>

<pre><code>    package MyClass;
    use Module::Pluggable search_path =&gt; [&#39;Acme::MyClass::Plugin&#39;, &#39;MyClass::Extend&#39;];</code></pre>

<p>or directory</p>

<pre><code>    use Module::Pluggable search_dirs =&gt; [&#39;mylibs/Foo&#39;];</code></pre>

<p>Or if you want to instantiate each plugin rather than just return the name</p>

<pre><code>    package MyClass;
    use Module::Pluggable instantiate =&gt; &#39;new&#39;;</code></pre>

<p>and then</p>

<pre><code>    # whatever is passed to &#39;plugins&#39; will be passed
    # to &#39;new&#39; for each plugin
    my @plugins = $mc-&gt;plugins(@options);</code></pre>

<p>alternatively you can just require the module without instantiating it</p>

<pre><code>    package MyClass;
    use Module::Pluggable require =&gt; 1;</code></pre>

<p>since requiring automatically searches inner packages, which may not be desirable, you can turn this off</p>

<pre><code>    package MyClass;
    use Module::Pluggable require =&gt; 1, inner =&gt; 0;</code></pre>

<p>You can limit the plugins loaded using the except option, either as a string, array ref or regex</p>

<pre><code>    package MyClass;
    use Module::Pluggable except =&gt; &#39;MyClass::Plugin::Foo&#39;;</code></pre>

<p>or</p>

<pre><code>    package MyClass;
    use Module::Pluggable except =&gt; [&#39;MyClass::Plugin::Foo&#39;, &#39;MyClass::Plugin::Bar&#39;];</code></pre>

<p>or</p>

<pre><code>    package MyClass;
    use Module::Pluggable except =&gt; qr/^MyClass::Plugin::(Foo|Bar)$/;</code></pre>

<p>and similarly for only which will only load plugins which match.</p>

<p>Remember you can use the module more than once</p>

<pre><code>    package MyClass;
    use Module::Pluggable search_path =&gt; &#39;MyClass::Filters&#39; sub_name =&gt; &#39;filters&#39;;
    use Module::Pluggable search_path =&gt; &#39;MyClass::Plugins&#39; sub_name =&gt; &#39;plugins&#39;;</code></pre>

<p>and then later ...</p>

<pre><code>    my @filters = $self-&gt;filters;
    my @plugins = $self-&gt;plugins;</code></pre>

<h1 id="PLUGIN-SEARCHING"><a id="PLUGIN"></a>PLUGIN SEARCHING</h1>

<p>Every time you call &#39;plugins&#39; the whole search path is walked again. This allows for dynamically loading plugins even at run time. However this can get expensive and so if you don&#39;t expect to want to add new plugins at run time you could do</p>

<pre><code>  package Foo;
  use strict;
  use Module::Pluggable sub_name =&gt; &#39;_plugins&#39;;

  our @PLUGINS;
  sub plugins { @PLUGINS ||= shift-&gt;_plugins }
  1;</code></pre>

<h1 id="INNER-PACKAGES"><a id="INNER"></a>INNER PACKAGES</h1>

<p>If you have, for example, a file <b>lib/Something/Plugin/Foo.pm</b> that contains package definitions for both <code>Something::Plugin::Foo</code> and <code>Something::Plugin::Bar</code> then as long as you either have either the <b>require</b> or <b>instantiate</b> option set then we&#39;ll also find <code>Something::Plugin::Bar</code>. Nifty!</p>

<h1 id="OPTIONS">OPTIONS</h1>

<p>You can pass a hash of options when importing this module.</p>

<p>The options can be ...</p>

<h2 id="sub_name">sub_name</h2>

<p>The name of the subroutine to create in your namespace.</p>

<p>By default this is &#39;plugins&#39;</p>

<h2 id="search_path">search_path</h2>

<p>An array ref of namespaces to look in.</p>

<h2 id="search_dirs">search_dirs</h2>

<p>An array ref of directories to look in before @INC.</p>

<h2 id="instantiate">instantiate</h2>

<p>Call this method on the class. In general this will probably be &#39;new&#39; but it can be whatever you want. Whatever arguments are passed to &#39;plugins&#39; will be passed to the method.</p>

<p>The default is &#39;undef&#39; i.e just return the class name.</p>

<h2 id="require">require</h2>

<p>Just require the class, don&#39;t instantiate (overrides &#39;instantiate&#39;);</p>

<h2 id="inner">inner</h2>

<p>If set to 0 will <b>not</b> search inner packages. If set to 1 will override <code>require</code>.</p>

<h2 id="only">only</h2>

<p>Takes a string, array ref or regex describing the names of the only plugins to return. Whilst this may seem perverse ... well, it is. But it also makes sense. Trust me.</p>

<h2 id="except">except</h2>

<p>Similar to <code>only</code> it takes a description of plugins to exclude from returning. This is slightly less perverse.</p>

<h2 id="package">package</h2>

<p>This is for use by extension modules which build on <code>Module::Pluggable</code>: passing a <code>package</code> option allows you to place the plugin method in a different package other than your own.</p>

<h2 id="file_regex">file_regex</h2>

<p>By default <code>Module::Pluggable</code> only looks for <i>.pm</i> files.</p>

<p>By supplying a new <code>file_regex</code> then you can change this behaviour e.g</p>

<pre><code>    file_regex =&gt; qr/\.plugin$/</code></pre>

<h2 id="include_editor_junk">include_editor_junk</h2>

<p>By default <code>Module::Pluggable</code> ignores files that look like they were left behind by editors. Currently this means files ending in <i>~</i> (~), the extensions <i>.swp</i> or <i>.swo</i>, or files beginning with <i>.#</i>.</p>

<p>Setting <code>include_editor_junk</code> changes <code>Module::Pluggable</code> so it does not ignore any files it finds.</p>

<h2 id="follow_symlinks">follow_symlinks</h2>

<p>Whether, when searching directories, to follow symlinks.</p>

<p>Defaults to 1 i.e do follow symlinks.</p>

<h2 id="min_depth,-max_depth"><a id="min_depth"></a><a id="min_depth--max_depth"></a>min_depth, max_depth</h2>

<p>This will allow you to set what &#39;depth&#39; of plugin will be allowed.</p>

<p>So, for example, <code>MyClass::Plugin::Foo</code> will have a depth of 3 and <code>MyClass::Plugin::Foo::Bar</code> will have a depth of 4 so to only get the former (i.e <code>MyClass::Plugin::Foo</code>) do</p>

<pre><code>        package MyClass;
        use Module::Pluggable max_depth =&gt; 3;</code></pre>

<p>and to only get the latter (i.e <code>MyClass::Plugin::Foo::Bar</code>)</p>

<pre><code>        package MyClass;
        use Module::Pluggable min_depth =&gt; 4;</code></pre>

<h1 id="TRIGGERS">TRIGGERS</h1>

<p>Various triggers can also be passed in to the options.</p>

<p>If any of these triggers return 0 then the plugin will not be returned.</p>

<h2 id="before_require-&lt;plugin&gt;"><a id="before_require"></a><a id="before_require--plugin"></a>before_require &lt;plugin&gt;</h2>

<p>Gets passed the plugin name.</p>

<p>If 0 is returned then this plugin will not be required either.</p>

<h2 id="on_require_error-&lt;plugin&gt;-&lt;err&gt;"><a id="on_require_error"></a><a id="on_require_error--plugin---err"></a>on_require_error &lt;plugin&gt; &lt;err&gt;</h2>

<p>Gets called when there&#39;s an error on requiring the plugin.</p>

<p>Gets passed the plugin name and the error.</p>

<p>The default on_require_error handler is to <code>carp</code> the error and return 0.</p>

<h2 id="on_instantiate_error-&lt;plugin&gt;-&lt;err&gt;"><a id="on_instantiate_error"></a><a id="on_instantiate_error--plugin---err"></a>on_instantiate_error &lt;plugin&gt; &lt;err&gt;</h2>

<p>Gets called when there&#39;s an error on instantiating the plugin.</p>

<p>Gets passed the plugin name and the error.</p>

<p>The default on_instantiate_error handler is to <code>carp</code> the error and return 0.</p>

<h2 id="after_require-&lt;plugin&gt;"><a id="after_require"></a><a id="after_require--plugin"></a>after_require &lt;plugin&gt;</h2>

<p>Gets passed the plugin name.</p>

<p>If 0 is returned then this plugin will be required but not returned as a plugin.</p>

<h1 id="METHODs">METHODs</h1>

<h2 id="search_path1">search_path</h2>

<p>The method <code>search_path</code> is exported into you namespace as well. You can call that at any time to change or replace the search_path.</p>

<pre><code>    $self-&gt;search_path( add =&gt; &quot;New::Path&quot; ); # add
    $self-&gt;search_path( new =&gt; &quot;New::Path&quot; ); # replace</code></pre>

<h1 id="BEHAVIOUR-UNDER-TEST-ENVIRONMENT"><a id="BEHAVIOUR"></a>BEHAVIOUR UNDER TEST ENVIRONMENT</h1>

<p>In order to make testing reliable we exclude anything not from blib if blib.pm is in %INC.</p>

<p>However if the module being tested used another module that itself used <code>Module::Pluggable</code> then the second module would fail. This was fixed by checking to see if the caller had (^|/)blib/ in their filename.</p>

<p>There&#39;s an argument that this is the wrong behaviour and that modules should explicitly trigger this behaviour but that particular code has been around for 7 years now and I&#39;m reluctant to change the default behaviour.</p>

<p>You can now (as of version 4.1) force Module::Pluggable to look outside blib in a test environment by doing either</p>

<pre><code>        require Module::Pluggable;
        $Module::Pluggable::FORCE_SEARCH_ALL_PATHS = 1;
        import Module::Pluggable;</code></pre>

<p>or</p>

<pre><code>        use Module::Pluggable force_search_all_paths =&gt; 1;</code></pre>

<h1 id="@INC-hooks-and-App::FatPacker"><a id="INC-hooks-and-App::FatPacker"></a>@INC hooks and App::FatPacker</h1>

<p>If a module&#39;s @INC has a hook and that hook is an object which has a <code>files()</code> method then we will try and require those files too. See <code>t/26inc_hook.t</code> for an example.</p>

<p>This has allowed <a href="https://metacpan.org/pod/App::FatPacker">App::FatPacker</a> (as of version 0.10.0) to provide support for Module::Pluggable.</p>

<p>This should also, theoretically, allow someone to modify PAR to do the same thing.</p>

<h1 id="Module::Require-recommended"><a id="Module"></a>Module::Require recommended</h1>

<p>Up until version 5.2 <a href="./Module::Pluggable.html">Module::Pluggable</a> used a string <code>eval</code> to require plugins.</p>

<p>This has now been changed to optionally use <a href="./Module::Runtime.html">Module::Runtime</a> and it&#39;s <code>require_module</code> method when available and fall back to using a path based <code>require</code> when not.</p>

<p>It&#39;s recommended, but not required, that you install Module::Runtime.</p>

<h1 id="FUTURE-PLANS"><a id="FUTURE"></a>FUTURE PLANS</h1>

<p>This does everything I need and I can&#39;t really think of any other features I want to add. Famous last words of course (not least because we&#39;re up to version 5.0 at the time of writing).</p>

<p>However suggestions (and patches) are always welcome.</p>

<h1 id="DEVELOPMENT">DEVELOPMENT</h1>

<p>The master repo for this module is at</p>

<p>https://github.com/simonwistow/Module-Pluggable</p>

<h1 id="AUTHOR">AUTHOR</h1>

<p>Simon Wistow &lt;simon@thegestalt.org&gt;</p>

<h1 id="COPYING">COPYING</h1>

<p>Copyright, 2006 Simon Wistow</p>

<p>Distributed under the same terms as Perl itself.</p>

<h1 id="BUGS">BUGS</h1>

<p>None known.</p>

<h1 id="SEE-ALSO"><a id="SEE"></a>SEE ALSO</h1>

<p><a href="https://metacpan.org/pod/File::Spec">File::Spec</a>, <a href="https://metacpan.org/pod/File::Find">File::Find</a>, <a href="https://metacpan.org/pod/File::Basename">File::Basename</a>, <a href="https://metacpan.org/pod/Class::Factory::Util">Class::Factory::Util</a>, <a href="https://metacpan.org/pod/Module::Pluggable::Ordered">Module::Pluggable::Ordered</a></p></div>

<div id="metacpan_install-instructions-dialog" class="modal fade">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title">Module Install Instructions</h4>
      </div>
      <div class="modal-body">
        <p>To install Module::Pluggable, copy and paste the appropriate command in to your terminal.</p>
        <p><a href="https://metacpan.org/dist/App-cpanminus/view/bin/cpanm">cpanm</a></p>
        <pre><code>cpanm Module::Pluggable</code></pre>
        <p><a href="https://metacpan.org/pod/CPAN">CPAN shell</a></p>
        <pre><code>perl -MCPAN -e shell
install Module::Pluggable</code></pre>
        <p>For more information on module installation, please visit <a href="https://www.cpan.org/modules/INSTALL.html">the detailed CPAN module installation guide</a>.</p>
      </div>
      <div class="modal-footer">
        <a href="./Module::Pluggable.html#" data-dismiss="modal" class="btn">Close</a>
      </div>
    </div>
  </div>
</div>
          </main>
          <div class="content-pagination">
          </div>
        </div>
        <footer class="footer">
          <div class="footer-container">
            <div class="footer-social">
              <div class="footer-link footer-logo">
                <a href="https://metacpan.org/">
                  <img src="https://metacpan.org/static/images/metacpan-logo.svg" alt="MetaCPAN" />
                </a>
              </div>
              <a class="footer-social-link" href="https://github.com/metacpan">
                <i class="fab fa-github-square"></i>
              </a>
              <a class="footer-social-link" href="https://fosstodon.org/@metacpan">
                <i class="fab fa-mastodon"></i>
              </a>
            </div>
            <div class="footer-links">
              <div class="footer-link">
                  <a href="https://metacpan.org/about">About</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/about/sponsors">Sponsor</a>
              </div>
              <div class="footer-link">
                  <a href="https://grep.metacpan.org">grep::cpan</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/recent">Recent</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/about/faq">FAQ</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/tools">Tools</a>
              </div>
              <div class="footer-link">
                  <a href="https://fastapi.metacpan.org/">API</a>
              </div>
              <div class="footer-link">
                  <a href="https://www.perl.org/">Perl.org</a>
              </div>
            </div>
            <div class="footer-sponsors">
              <a class="footer-sponsor-link" target="_blank" href="https://www.bytemark.co.uk/" rel="noopener">
                <img class="footer-sponsor-bytemark" src="https://metacpan.org/static/images/sponsors/bytemark_logo.svg" alt="Bytemark logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://www.liquidweb.com/" rel="noopener">
                <img class="footer-sponsor-liquidweb" src="https://metacpan.org/static/images/sponsors/liquidweb_logo.png" alt="liquidweb logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://deriv.com/careers/" rel="noopener">
                <img class="footer-sponsor-deriv" src="https://metacpan.org/static/images/sponsors/deriv.svg" alt="Deriv logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://geocode.xyz" rel="noopener">
                <img class="footer-sponsor-geocode" src="https://metacpan.org/static/images/sponsors/geocodelogo.svg" alt="Geocode logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://www.fastly.com/" rel="noopener">
                <img class="footer-sponsor-fastly" src="https://metacpan.org/static/images/sponsors/fastly_logo.svg" alt="Fastly logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://opencagedata.com" rel="noopener">
                <img class="footer-sponsor-opencage" src="https://metacpan.org/static/images/sponsors/open-cage.svg" alt="OpenCage logo">
              </a>
            </div>
          </div>
        </footer>
        <div class="modal fade" tabindex="-1" role="dialog" id="metacpan_keyboard-shortcuts">
          <div class="modal-dialog">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Keyboard Shortcuts</h4>
              </div>
              <div class="modal-body row">
<div class="col-md-6">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>Global</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>s</kbd>
        </td>
        <td>Focus search bar</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>?</kbd>
        </td>
        <td>Bring up this help dialog</td>
      </tr>
    </tbody>
  </table>

  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>GitHub</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>p</kbd>
        </td>
        <td>Go to pull requests</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>i</kbd>
        </td>
        <td>go to github issues (only if github is preferred repository)</td>
      </tr>
    </tbody>
  </table>
</div>

<div class="col-md-6">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>POD</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>a</kbd>
        </td>
        <td>Go to author</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>c</kbd>
        </td>
        <td>Go to changes</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>i</kbd>
        </td>
        <td>Go to issues</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>d</kbd>
        </td>
        <td>Go to dist</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>r</kbd>
        </td>
        <td>Go to repository/SCM</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>s</kbd>
        </td>
        <td>Go to source</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>b</kbd>
        </td>
        <td>Go to file browse</td>
      </tr>

    </tbody>
  </table>
</div>

<div class="col-md-12">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>Search terms</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><em>module:</em> (e.g. <a href="https://metacpan.org/search?q=module%3APlugin">module:Plugin</a>)</td>
      </tr>
      <tr>
        <td><em>distribution:</em> (e.g. <a href="https://metacpan.org/search?q=distribution%3ADancer+auth">distribution:Dancer auth</a>)</td>
      </tr>
      <tr>
        <td><em>author:</em> (e.g. <a href="https://metacpan.org/search?q=author%3ASONGMU+Redis">author:SONGMU Redis</a>)</td>
      </tr>
      <tr>
        <td><em>version:</em> (e.g. <a href="https://metacpan.org/search?q=version%3A1.00">version:1.00</a>)</td>
      </tr>
    </tbody>
  </table>
</div>
              </div>
              <div class="modal-footer"></div>
            </div>
          </div>
        </div>
    </body>
</html>
